import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '@/views/index.vue'
import film from '@/views/film/index.vue'
import cinema from '@/views/cinema/index.vue'
import my from '@/views/my/index.vue'
import news from '@/views/news/index.vue'
import reying from '@/views/film/reying.vue'
import shangying from '@/views/film/shangying.vue'
import cinemabuy from '@/views/cinemabuy/index.vue'
import detail from '@/views/detail/index.vue'
import city from '@/views/city/index.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: index,
    redirect: '/index',
    children: [
      {
        path: '/',
        redirect: '/film',
      },
      {
        path: '/film',
        component: film,
        children: [
          {
            path: '/film',
            redirect: '/film/reying'
          },
          {
            path: '/film/reying',
            component: reying,
          },
          {
            path: '/film/shangying',
            component: shangying,
          },
        ]
      },

      {
        path: '/cinema',
        component: cinema,
      },
      {
        path: '/my',
        component: my,
      },
      {
        path: '/news',
        component: news,
      }
    ]
  },
  {
    path:'/film/cinemabuy',
    component:cinemabuy
  },
  {
    path:'/film/detail/:filmId',
    name:'detail',
    component:detail
  },
  {
    path:'/city',
    component:city
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
